﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Dialog.Master" AutoEventWireup="true"
    CodeBehind="UserSelector.aspx.cs" Inherits="NetDon.OA.Portal.Controls.UserSelector1" %>

<%@ Import Namespace="NetDon.OA.Business" %>
<%@ Import Namespace="NetDon.OA.Interface" %>
<%@ Import Namespace="NetDon.Utilities" %>
<%@ Register Src="../Controls/GridPager.ascx" TagName="GridPager" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script language="javascript" type="text/javascript">

        var treeview;
        function flyTreeView_onInitialized(treeviewObject) {
            treeview = treeviewObject;
        }
        function SelectedNodeChanged() {
            $get('<%=btnDisplay.ClientID %>').click();
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td valign="top">
                <NineRays:FlyTreeView ID="treeCompany" Width="280px" runat="server" Height="480px"
                    DrawLines="true" ContentClickExpands="false" OnPopulateNodes="treeCompany_PopulateNodes"
                    OnInitializedJavascript="flyTreeView_onInitialized" OnSelectedNodeChangedJavascript="SelectedNodeChanged">
                </NineRays:FlyTreeView>
            </td>
            <td valign="top">
                <NetDon:GridView ID="gridUsers" runat="server" DataKeyNames="UserId" AllowSorting="true"
                    Visible="false" OnRowDataBound="gridUsers_RowDataBound" OnClientRowDblClick="viewUser">
                    <Columns>
                        <NetDon:TemplateField>
                            <HeaderStyle HorizontalAlign="Center" Width="40px" />
                            <HeaderTemplate>
                                <asp:CheckBox ID="chkSelectAll" runat="server" onclick="SelectAll(this)" />
                            </HeaderTemplate>
                            <ItemStyle HorizontalAlign="Center" Width="40px" />
                            <ItemTemplate>
                                <asp:CheckBox ID="chkSelect" runat="server" />
                            </ItemTemplate>
                        </NetDon:TemplateField>
                        <NetDon:BoundField HeaderText="Login Name" SortExpression="LoginName" DataField="LoginName">
                        </NetDon:BoundField>
                        <NetDon:TemplateField HeaderText="FullName" SortExpression="FullName">
                            <ItemTemplate>
                                <%#Server.HtmlEncode(Convert.ToString(Eval("FullName")))%>
                            </ItemTemplate>
                        </NetDon:TemplateField>
                        <NetDon:BoundField HeaderText="Email" SortExpression="Email" DataField="Email">
                        </NetDon:BoundField>
                        <NetDon:TemplateField HeaderText="UserType" SortExpression="UserType">
                            <ItemTemplate>
                                <%#Server.HtmlEncode(EnumUtilities.GetDescription((UserType)Convert.ToInt32(Eval("UserType"))))%>
                            </ItemTemplate>
                        </NetDon:TemplateField>
                        <NetDon:TemplateField HeaderText="CreateDate" SortExpression="CreateDate">
                            <ItemTemplate>
                                <%#( Eval("CreateDate")==DBNull.Value? "":(Convert.ToDateTime(Eval("CreateDate"))).ToString(SystemConfiguration.DateFormat))%>
                            </ItemTemplate>
                        </NetDon:TemplateField>
                        <NetDon:TemplateField HeaderText="Status" SortExpression="Status">
                            <ItemTemplate>
                                <%#Server.HtmlEncode(EnumUtilities.GetDescription((UserStatus)Convert.ToInt32( Eval("Status")))) %>
                            </ItemTemplate>
                        </NetDon:TemplateField>
                    </Columns>
                </NetDon:GridView>
                <uc1:GridPager ID="PagerUsers" runat="server" TargetControlID="gridUsers" PageSize="20"
                    OnPerformGetCondition="PagerUsers_PerformGetCondition" OnPerformGetRecordCount="PagerUsers_PerformGetRecordCount"
                    OnPerformGetPageData="PagerUsers_PerformGetPageData" />
                <div style="margin-top: 10px; text-align: center">
                    <asp:ValidationSummary ID="ValidationSummary1" runat="server" DisplayMode="List"
                        ShowMessageBox="True" ShowSummary="False" />
                    <asp:Button ID="btnDisplay" runat="server" OnClick="btnDisplay_Click" Style="display: none"
                        CausesValidation="False" />
                </div>
            </td>
        </tr>
    </table>
</asp:Content>
